3.138 \(\int (a+b \tanh ^2(c+d x)) \, dx\)

Optimal. Leaf size=19 \[ a x-\frac{b \tanh (c+d x)}{d}+b x \]

[Out]

a*x + b*x - (b*Tanh[c + d*x])/d

________________________________________________________________________________________

Rubi [A]  time = 0.0132686, antiderivative size = 19, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 12, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.167, Rules used = {3473, 8} \[ a x-\frac{b \tanh (c+d x)}{d}+b x \]

Antiderivative was successfully verified.

[In]

Int[a + b*Tanh[c + d*x]^2,x]

[Out]

a*x + b*x - (b*Tanh[c + d*x])/d

Rule 3473

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(b*Tan[c + d*x])^(n - 1))/(d*(n - 1)), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rubi steps

\begin{align*} \int \left (a+b \tanh ^2(c+d x)\right ) \, dx &=a x+b \int \tanh ^2(c+d x) \, dx\\ &=a x-\frac{b \tanh (c+d x)}{d}+b \int 1 \, dx\\ &=a x+b x-\frac{b \tanh (c+d x)}{d}\\ \end{align*}

Mathematica [A]  time = 0.0067343, size = 28, normalized size = 1.47 \[ a x+\frac{b \tanh ^{-1}(\tanh (c+d x))}{d}-\frac{b \tanh (c+d x)}{d} \]

Antiderivative was successfully verified.

[In]

Integrate[a + b*Tanh[c + d*x]^2,x]

[Out]

a*x + (b*ArcTanh[Tanh[c + d*x]])/d - (b*Tanh[c + d*x])/d

________________________________________________________________________________________

Maple [B]  time = 0.002, size = 47, normalized size = 2.5 \begin{align*} ax-{\frac{b\tanh \left ( dx+c \right ) }{d}}-{\frac{\ln \left ( \tanh \left ( dx+c \right ) -1 \right ) b}{2\,d}}+{\frac{\ln \left ( \tanh \left ( dx+c \right ) +1 \right ) b}{2\,d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(a+b*tanh(d*x+c)^2,x)

[Out]

a*x-b*tanh(d*x+c)/d-1/2/d*ln(tanh(d*x+c)-1)*b+1/2/d*ln(tanh(d*x+c)+1)*b

________________________________________________________________________________________

Maxima [A]  time = 1.09244, size = 42, normalized size = 2.21 \begin{align*} b{\left (x + \frac{c}{d} - \frac{2}{d{\left (e^{\left (-2 \, d x - 2 \, c\right )} + 1\right )}}\right )} + a x \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a+b*tanh(d*x+c)^2,x, algorithm="maxima")

[Out]

b*(x + c/d - 2/(d*(e^(-2*d*x - 2*c) + 1))) + a*x

________________________________________________________________________________________

Fricas [A]  time = 2.0544, size = 96, normalized size = 5.05 \begin{align*} \frac{{\left ({\left (a + b\right )} d x + b\right )} \cosh \left (d x + c\right ) - b \sinh \left (d x + c\right )}{d \cosh \left (d x + c\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a+b*tanh(d*x+c)^2,x, algorithm="fricas")

[Out]

(((a + b)*d*x + b)*cosh(d*x + c) - b*sinh(d*x + c))/(d*cosh(d*x + c))

________________________________________________________________________________________

Sympy [A]  time = 0.190726, size = 20, normalized size = 1.05 \begin{align*} a x + b \left (\begin{cases} x - \frac{\tanh{\left (c + d x \right )}}{d} & \text{for}\: d \neq 0 \\x \tanh ^{2}{\left (c \right )} & \text{otherwise} \end{cases}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a+b*tanh(d*x+c)**2,x)

[Out]

a*x + b*Piecewise((x - tanh(c + d*x)/d, Ne(d, 0)), (x*tanh(c)**2, True))

________________________________________________________________________________________

Giac [A]  time = 1.1661, size = 46, normalized size = 2.42 \begin{align*} a x + b{\left (\frac{d x + c}{d} + \frac{2}{d{\left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}}\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a+b*tanh(d*x+c)^2,x, algorithm="giac")

[Out]

a*x + b*((d*x + c)/d + 2/(d*(e^(2*d*x + 2*c) + 1)))